home *** CD-ROM | disk | FTP | other *** search
/ Aminet 51 / Aminet 51 (2002)(GTI - Schatztruhe)[!][Oct 2002].iso / Aminet / disk / misc / SectorCache.lha / SectorCache / About < prev    next >
Encoding:
Text File  |  2002-07-20  |  15.8 KB  |  460 lines

  1. Short:    Sector size converter, with Cache.
  2. Author:   sndev@bigfoot.com (Steven Norburn)
  3. Uploader: sndev@bigfoot.com (Steven Norburn)
  4. Type:     disk/misc
  5. Requires: a device to patch.
  6. Version:  0.12
  7.  
  8. This is part of range of packages designed originally for use with DVD-RAM
  9. drives, which has now become useful for other types of drives.
  10.  
  11. About SectorCache:
  12. ------------------
  13.  
  14. This is a CLI Shell device patch program for changing the sector size of a
  15. device, but it also features a cache and command converter.
  16.  
  17. The minimum sector size of DVD-RAM for example is 2048 bytes, the maximum
  18. PFS3 sector size is 1024 bytes, so we have a problem !
  19.  
  20. The SectorCache patch lets PFS3 think DVD-RAM is a 512 or 1024 bytes per
  21. sector device and converts the sizes accordingly.  It also caches small
  22. reads by age and can convert 64 bit device commands into another form.
  23.  
  24. It doesn't just work with PFS and DVD-RAM, it can work with any track disk
  25. type device or any filesystem.
  26.  
  27. It can also be used to mount for example a 512 bytes per sector partition,
  28. which has been block copied to device with a larger sector size (maybe CD-R
  29. or CD-RW), the FileSystem will still see 512 byte sectors.
  30.  
  31. * Warning *
  32.  
  33.   This is a not completely tested * BETA * and because it patches the
  34.   device, any remaining bugs may destroy your data or corrupt your disk
  35.   filesystem structure.  * USE AT YOUR OWN RISK ! *
  36.  
  37.   Like all patches, the code can also be corrupted by other programs, it's
  38.   only therefore recommended to be used when needed.
  39.  
  40.  
  41. Usage:  SectorCache Device/A,Unit/A/N,
  42.  
  43.     "Device/A,Unit/N,"
  44.     "E=EmuSize/N,D=DevSize/N,C=CacheBlock/N,L=LineLength/N,S=SetSize/N,"
  45.     "ETD64/S,NSD64/S,TD64/S,SD64=SCSIDirect64/S,SD=SCSIDirect/S,"
  46.     "SCL=SCSICommandLength/N,"
  47.     "DT=DevType/N,MT=MemType/N,"
  48.     "NDR=NoDirectRead/S,NDW=NoDirectWrite/S,"
  49.     "NCC=NoCommandConvert/S,"
  50.     "NC=NoCache/S,AC=AllocCache/S,MF=MemFlush/S,"
  51.     "WAV=WriteAndVerify/S,"
  52.     "SS=SwapStack/N,ATP=AsyncTaskPriority/N,"
  53.     "AsyncIO/S,SyncIO/S,NoRead/S,NoWrite/S,"
  54.     "NGG=NoGetGeometry/S,NSG=NoSCSIGeometry/S,CRC32=CheckSumCRC32/S,"
  55.     "MTD=MapToDevice,MTU=MapToUnit/N,MUS=MapUnitSize/N,MTZ=MapToZero/S"
  56.  
  57. *New*    Device/A, the name of the device or partition to patch,
  58.     i.e. scsi.device or DH1, DF0 etc.
  59.  
  60.     Unit/A/N, the unit number of the device to patch, i.e. 3.
  61.  
  62.     E=EmuSize/N [DevSize], the size of the sector to emulate, i.e. 512.
  63.     Note, SectorCache needs to be active before the driver is mounted !
  64.  
  65.     D=DevSize/N [???], this is normally set automatically and shouldn't
  66.     be changed.  With this you can manually set the value.
  67.  
  68.     C=CacheBlock/N [4096 Bytes], this is the size in bytes of a single
  69.     cache block, it will always be divisible by DevSize.  When a sector
  70.     is requested which is not in the cache, the whole cache block will
  71.     be filled with data.  Each cache block has a identification key
  72.     with the age it was created.  When the cache is full, the oldest
  73.     cache blocks will be reused.  The key is the alined sector number
  74.     at the start of a cache block.
  75.  
  76.     L=LineLength/N [5 = 2^5 = 32], cache blocks are grouped together by
  77.     dividing sectors into blocks of cache lines.  A sector will always
  78.     occupy the same place in a cache block and a cache block will
  79.     always occupy the same place in the cache line.  This helps to also
  80.     improve cache searching speeds.
  81.  
  82.     S=SetSize/N [8], independent cache lines are grouped together in a
  83.     set.  This allows sectors to be cached which have the same relative
  84.     position in a cache line.  If a free cache block is not found in
  85.     any of the lines, the oldest cache block will be reused.
  86.  
  87.     ETD64/S, convert some SCSI Direct and other types of 64 bit
  88.     commands to New Style Extended Track Disk 64 bit commands.
  89.  
  90.     NSD64/S, convert some SCSI Direct and other types of 64 bit
  91.     commands to New Style Track Disk 64 bit commands and ignore
  92.     extended data.
  93.  
  94.     TD64/S, convert some SCSI Direct and other types of 64 bit commands
  95.     to Track Disk 64 bit commands.
  96.  
  97. *New*    SD64=SCSIDirect64/S, convert other types of 64 bit commands to SCSI
  98.     Direct commands.
  99.  
  100. *New*    SD=SCSIDirect/S, convert all read and write commands to SCSI Direct
  101.     commands.
  102.  
  103. *New*    SCL=SCSICommandLength/N, set the SCSI command length.  Supports SCSI
  104.     command types 6,10,12,16 bytes, the default is 12.
  105.  
  106.     In SCSI Block Commands - 2 (SBC-2), READ(12) implementation is
  107.     optional.  If any of WRITE (6)/(10)/(12) is implemented, WRITE(16)
  108.     shall also be implemented.
  109.  
  110. +=================================================+
  111. | SBC | LOGICAL BLOCK ADDRESS  | TRANSFER LENGTH  |
  112. |-----+------------------------+------------------|
  113. |  6  | 21 bit (1 GB)          | 8 bit (256 B)    |
  114. | 10  | 32 bit (2 TB)          | 16 bit (65535 B) |
  115. | 12  | 32 bit (2 TB)          | 32 bit (2 TB)    |
  116. | 16  | 64 bit (8589934586 TB) | 32 bit (2 TB)    |
  117. |-----+------------------------+------------------|
  118. |     |  (With logical block sizes of 512 bytes)  |
  119. +=================================================+
  120.  
  121.     DT=DevType/N, this changes the SCSI-2 Device Type number returned
  122.     from the device.  So setting DT to 0 (Direct-access device) allows
  123.     HDToolBox to use DVD-RAM discs which normally returns 5 (CD-ROM).
  124.  
  125. +=======================================================================+
  126. |  DT    | Doc.    | Description                        |
  127. |-------+-------+-------------------------------------------------------|
  128. |  00    | SBC    | Direct-access device (e.g. magnetic disk).        |
  129. |  01    | SSC    | Sequential-access device (e.g. magnetic tape).    |
  130. |  02    | SSC    | Printer device.                    |
  131. |  03    | SPC-2    | Processor device.                    |
  132. |  04    | SBC    | Write-once device (e.g. some optical disks).        |
  133. |  05    | MMC-2    | CD-ROM device.                    |
  134. |  06    | SCSI-2| Scanner device.                    |
  135. |  07    | SBC    | Optical memory device (e.g. some optical disks).    |
  136. |  08    | SMC    | Medium changer device (e.g. jukeboxes).        |
  137. |  09    | SCSI-2| Communications device.                |
  138. |10->11    |     | Defined by ASC IT8 (Graphic arts pre-press devices).    |
  139. |  12    | SCC-2    | Storage array controller device (e.g. RAID).        |
  140. |  13    | SES    | Enclosure services device.                |
  141. |  14    | RBC    | Simplified direct-access device (e.g. magnetic disk).    |
  142. |  15    | OCRW    | Optical card reader/writer device            |
  143. |  16    |    | Reserved for use by Bridging Expanders.        |
  144. |  17    | OSD    | Object-based Storage Device.                |
  145. |18->30    |    | Reserved.                        |
  146. |  31    |    | Unknown or no device type.                |
  147. +=======================================================================+
  148.  
  149.     MT=MemType/S [MEMF_ANY | MEMF_PUBLIC], this forces the cache memory
  150.     to be allocated using the given Memory Requirement Type, some older
  151.     controller devices can only use 24 bit DMA memory.
  152.  
  153.         These types should work with any controller device.
  154.  
  155.         512 (MEMF_24BITDMA, 24 Bit DMAable Memory, 16 MB)
  156.           2 (MEMF_CHIP, 21 Bit CHIP Memory, 2 MB)
  157.  
  158.         These types should work with any modern controller device.
  159.  
  160.           0 (MEMF_ANY, use any type, but FAST first)
  161.           4 (MEMF_FAST, never use CHIP type memory)
  162.  
  163.         To use MEMF_PUBLIC memory, add 1 to the Memory Type value.
  164.  
  165.         To use MEMF_REVERSE memory, add 262144 (2^18).
  166.  
  167.         So, MEMF_24BITDMA | MEMF_REVERSE would be MT=262656. 
  168.  
  169.     NDR=NoDirectRead/S, large reads of incremental sectors are not
  170.     normally cached, this forces all reads to go through the cache
  171.     system.
  172.  
  173.     NDW=NoDirectWrite/S, large writes of incremental sectors are not
  174.     normally cached, this forces all writes to go through the cache
  175.     system.
  176.  
  177.     NCC=NoCommandConvert/S, try to use a similar type of device
  178.     commands as those originally requested.
  179.  
  180.     NC=NoCache/S, this disables the main cache except for one alinement
  181.     correction cache block.
  182.  
  183.     AC=AllocCache/S, this allocates all the cache memory, this means
  184.     that the cache memory is always available when needed and may also
  185.     help to reduce system memory fragmentation.
  186.  
  187.     MF=MemFlush/S, this returns cache block memory to the system when a
  188.     clear or disk change is detected.  It may however increase system
  189.     memory fragmentation.
  190.  
  191.     WAV=WriteAndVerify, this replaces the standard Write commands with
  192.     a SCSI Direct WriteAndVerify 12 byte command.  It maybe useful for
  193.     some types of optical drives.
  194.  
  195.     SS=SwapStack/N [4096 Bytes], this allows the Synchronous Quick IO
  196.     stack (which is needed when using FastFileSystem) to be changed.
  197.  
  198.     ATP=AsyncTaskPriority/N [10], this allows the Asynchronous Task
  199.     Priority to be changed.
  200.  
  201.     AsyncIO/S, all IO is forced to be Asynchronous.  Normally Quick IO
  202.     requests are processed using the fast Synchronous IO system.
  203.  
  204.     SyncIO/S, Read and Write commands will be forced to be Synchronous
  205.     (FFS doesn't like this because Asynchronous commands have to wait).
  206.  
  207. *New*    NoRead/S, Read commands are disabled so nothing should be read from
  208.     a device, it's mainly used for testing.  When used with NDR and NDW
  209.     the cache can be used to create a limited virtual disk.
  210.  
  211.     NoWrite/S, Write, Format, Update and Clear commands are disabled so
  212.     nothing should be written, it's mainly used for testing.  When used
  213.     with NDR and NDW the cache can be used to create a limited virtual
  214.     disk.
  215.  
  216.     Blocked commands; TD, NSD, TD64 and SCSI_Direct except,
  217.     TESTUNITREADY, REQUESTSENSE, INQUIRY, SENDDIAGNOSTIC, READCAPACITY
  218.  
  219. *New*    NGG=NoGetGeometry/S, disable the trackdisk GetGeometry command,
  220.     this stops some filesystems from ignoring the mount settings and
  221.     getting the geometry directly from the drive.
  222.  
  223. *New*    NSG=NoSCSIGeometry/S, if a device doesn't support the GetGeometry
  224.     command, SCSI Direct is used to create a fake GetGeometry, this
  225.     will not happen with this option.
  226.  
  227. *New*    CRC32=CheckSumCRC32/S, CheckSums to protect the Cache Memory are
  228.     normally calculated using the simple and fast Sum Long method as
  229.     used in OFS/FFS.  This allows the use of the better but slower
  230.     CRC-32 (Cycle Redundancy Check 32-bit) method, as used by Zip,
  231.     GZip, LZX, RAR, Arj etc.
  232.  
  233. *Not Yet Implemented*
  234.     MTD=MapToDevice
  235.     MTU=MapToUnit/N
  236.     MUS=MapUnitSize/N
  237.     MTZ=MapToZero/S"
  238.  
  239.  
  240. For example, to use the cache with DF2: trackdisk.device unit 2,
  241.  
  242.     'SectorCache trackdisk.device 2' or 'SectorCache DF2'
  243.  
  244. Possible result,
  245.  
  246.     * Beta Release, Use at your Own Risk ! *
  247.  
  248.     SectorCache Removable Media, unit 2 on trackdisk.device
  249.  
  250.     It's a New Style (TD) device.
  251.     Asynchronous Task Priority set to 10
  252.  
  253.     Emulated Sector = 512 Bytes
  254.     Device Sector   = 512 Bytes
  255.     Cache Block     = 4096 Bytes
  256.     Line Length     = 2^5 (32 Blocks)
  257.     Set Size        = 8 Lines
  258.     Maximum Cache   = 1048576 Bytes
  259.     Swap Stack      = 4096 Bytes
  260.     Active on Device (0x70083C4)
  261.         [ After Ctrl C ]
  262.     Read            : Cached = 5657, Direct = 0
  263.     Write           : Cached = 0, Direct = 0
  264.     Cache           : Hit = 5441, Miss = 216, Made = 216, Flush = 0
  265.     IO Commands     = 5721
  266.     Stack Used      = 108 Bytes
  267.     Removed from, unit 2 on trackdisk.device
  268.  
  269.  
  270. Silly example, to use HDToolBox with an emulated sector size 512 bytes,
  271.  
  272.     'SectorCache scsi.device 3 512 dt=0'
  273.  
  274. Possible result,
  275.  
  276.     * Beta Release, Use at your Own Risk ! *
  277.  
  278.     SectorCache Removable Media, unit 3 on scsi.device
  279.  
  280.     It's a New Style (TD, SD, NSD64) & SCSI Direct device.
  281.     The recommended 64 bit command type is New Style (NSD64).
  282.     Converting SCSI & 64 bit commands to New Style (NSD64).
  283.     Changing from a Type 5 to a Type 0 device.
  284.     Asynchronous Task Priority set to 10
  285.  
  286.     Emulated Sector = 512 Bytes
  287.     Device Sector   = 2048 Bytes
  288.     Cache Block     = 4096 Bytes
  289.     Line Length     = 2^5 (32 Blocks)
  290.     Set Size        = 8 Lines
  291.     Maximum Cache   = 1048576 Bytes
  292.     Swap Stack      = 4096 Bytes
  293.     Active on Device (0x700A08C)
  294.         [ After Ctrl C ]
  295.     Read            : Cached = 921, Direct = 69
  296.     Write           : Cached = 718, Direct = 9
  297.     Cache           : Hit = 1408, Miss = 231, Made = 211, Flush = 2
  298.     IO Commands     = 1464
  299.     Stack Used      = 446 Bytes
  300.     Removed from, unit 3 on scsi.device
  301.  
  302.  
  303. If you don't want the above output to be displayed, you can always redirect
  304. it to >NIL:
  305.  
  306.  
  307. Supported 32 bit Device Commands:
  308. ---------------------------------
  309.  
  310. TD_GETGEOMETRY
  311.  
  312. CMD_CLEAR
  313.  
  314. CMD_READ, CMD_WRITE, CMD_SEEK, CMD_FORMAT
  315.  
  316. ETD_READ, ETD_WRITE, ETD_SEEK, ETD_FORMAT
  317.  
  318. Supported 64 bit Device Commands:
  319. ---------------------------------
  320.  
  321. TD_READ64, TD_WRITE64, TD_SEEK64, TD_FORMAT64
  322.  
  323. NSCMD_TD_READ64, NSCMD_TD_WRITE64, NSCMD_TD_SEEK64, NSCMD_TD_FORMAT64
  324.  
  325. NSCMD_ETD_READ64, NSCMD_ETD_WRITE64, NSCMD_ETD_SEEK64, NSCMD_ETD_FORMAT64
  326.  
  327. Supported SCSI Direct Commands:
  328. -------------------------------
  329.  
  330. SCSI_READ6, SCSI_READ10, SCSI_READ12, SCSI_READ16
  331.  
  332. SCSI_WRITE6, SCSI_WRITE10, SCSI_WRITE12, SCSI_WRITE16
  333.  
  334. SCSI_INQUIRY, SCSI_READCAPACITY, SCSI_TESTREADY
  335.  
  336. SCSI_WRITEANDVERIFY10, SCSI_WRITEANDVERIFY12, SCSI_WRITEANDVERIFY16
  337.  
  338.  
  339. This Distribution:
  340. ------------------
  341.  
  342. This is still a beta and may have some bugs that I've missed, but the more
  343. time I take trying to find bugs, the longer it takes to get released.
  344.  
  345. Any reported and confirmed bugs will be corrected in a hopefully quickly
  346. released next version.
  347.  
  348. If you have any suggestions or improvement you would like to see included
  349. in the next released version, please feel free to contact me.
  350.  
  351.  
  352. History:
  353. --------
  354.  
  355. 0.12ß (20.07.02)
  356.  
  357.     Added SD64=SCSIDirect64/S, SD=SCSIDirect/S,SCL=SCSICommandLength/N
  358.     Added NoRead/S, NGG=NoGetGeometry/S, NSG=NoSCSIGeometry/S
  359.     Added CRC32=CheckSumCRC32/S
  360.     Added Partition detection.
  361.  
  362. 0.11ß (29.10.01)
  363.  
  364.     Non Quick Asynchronous IO is now sent by default from this Process.
  365.     (FFS Forbid fix)
  366.  
  367.     Synchronous Quick IO now has a 4096 byte default Swap Stack.
  368.     (FFS swap stack overflow fix)
  369.  
  370.     Added ATP=AsyncTaskPriority/N, AsyncIO/S, SyncIO/S
  371.     Added NoWrite/S, SS=SwapStack/N
  372.  
  373.     Fixed two potentially data corrupting bugs.
  374.  
  375.     Added WAV=WriteAndVerify (Suggested by Mark Knibbs)
  376.     Added NC=NoCache/S, AC=AllocCache/S, MF=MemFlush/S
  377.  
  378.     Changed CHIP to MT=MemType/S (Suggested by Mark Knibbs)
  379.     Changed DType=DevType/N to DT=DevType/N
  380.     Changed NC=NoConvert/S to NCC=NoCommandConvert/S
  381.  
  382.     A quick re-Format bug should be fixed with FastFileSystem >= 43.13.
  383.     (LONG READ from, * move.l (a3)+,(a0)+ dbra d0, *)
  384.  
  385. 0.10ß (24.09.01)
  386.  
  387.     First release.
  388.  
  389.  
  390. Thanks To:
  391. ---------- 
  392.  
  393. All the people who have sent encouragement.
  394.  
  395. David Le Blanc    - for SmartDisk 1.3.
  396. Dirk Stoecker    - for GetCRC 1.16.
  397. Mark Knibbs    - for suggestions and comments.
  398.  
  399. Some Final Thoughts:
  400. --------------------
  401.  
  402. This is all Freeware !
  403.  
  404. If you have any problems, feel free to contact me.
  405.  
  406. Best Regards,
  407.  
  408.     Steven Norburn <sndev@bigfoot.com>
  409.  
  410.  
  411. Legal Stuff:
  412. ------------
  413.  
  414.  
  415. License:
  416. --------
  417.  
  418. This is released under the concept of freeware.  This means you are allowed
  419. to use and copy this archive freely, as long as the following requirements
  420. are fulfilled:
  421.  
  422.     All files are copied without any alterations or modifications.  If
  423.     any extra files are added, it must be obvious that they do not
  424.     belong to the original distribution, and that they do not need to
  425.     be included in any redistribution.  Exception:  So called "BBS ads"
  426.     may not be added.
  427.  
  428.     The copying is done on a non-commercial basis.  A small fee to
  429.     cover media costs etc.  may be charged.
  430.  
  431.     The copier is not claiming the copyright of this archive.
  432.  
  433. Any exceptions from the above require a written permission from the author.
  434.  
  435. If you want to publish this archive on a cover disk or similar, contact me
  436. first for approval (to make sure you have the latest version etc.).
  437.  
  438.  
  439. No Warranty:
  440. ------------
  441.  
  442. There is no warranty for the archive, to the extent permitted by applicable
  443. law.  Except when otherwise stated in writing the copyright holder and/or
  444. other parties provide the archive "as is" without warranty of any kind,
  445. either expressed or implied, including, but not limited to, the implied
  446. warranties of merchantability and fitness for a particular purpose.  The
  447. entire risk as to the quality and performance of the archive is with you.
  448. Should the archive prove defective, you assume the cost of all necessary
  449. servicing, repair or correction.
  450.  
  451. In no event unless required by applicable law or agreed to in writing will
  452. any copyright holder, or any other party who may redistribute the archive
  453. as permitted above, be liable to you for damages, including any general,
  454. special, incidental or consequential damages arising out of the use or
  455. inability to use the archive (including but not limited to loss of data or
  456. data being rendered inaccurate or losses sustained by you or third parties
  457. or a failure of the archive to operate with any other programs), even if
  458. such holder or other party has been advised of the possibility of such
  459. damages.
  460.